'\" t
.TH samtools-addreplacerg 1 "7 July 2021" "samtools-1.13" "Bioinformatics tools"
.SH NAME
samtools addreplacerg \- adds or replaces read group tags
.\"
.\" Copyright (C) 2008-2011, 2013-2018, 2020 Genome Research Ltd.
.\" Portions copyright (C) 2010, 2011 Broad Institute.
.\"
.\" Author: Heng Li <lh3@sanger.ac.uk>
.\" Author: Joshua C. Randall <jcrandall@alum.mit.edu>
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
.\" copy of this software and associated documentation files (the "Software"),
.\" to deal in the Software without restriction, including without limitation
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
.\" and/or sell copies of the Software, and to permit persons to whom the
.\" Software is furnished to do so, subject to the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
.\" DEALINGS IN THE SOFTWARE.
.
.\" For code blocks and examples (cf groff's Ultrix-specific man macros)
.de EX

.  in +\\$1
.  nf
.  ft CR
..
.de EE
.  ft
.  fi
.  in

..
.
.SH SYNOPSIS
.PP
samtools addreplacerg
.RB [ -r
.I rg-line
|
.B -R
.IR rg-ID ]
.RB [ -m
.IR mode ]
.RB [ -u ]
.RB [ -o
.IR out.bam ]
.I in.bam

.SH DESCRIPTION
.PP
Adds or replaces read group tags in a file. Also allows for adding and updating
@RG lines in the header.

.SH OPTIONS
.TP 8
.BI "-r " STRING
Allows you to specify a read group line to append to the header and applies it
to the reads specified by the -m option. If repeated it automatically adds in
tabs between invocations.
.TP 8
.BI "-R " STRING
Allows you to specify the read group ID of an existing @RG line and applies it
to the reads specified.
.TP 8
.BI "-m " MODE
If you choose orphan_only then existing RG tags are not overwritten, if you choose
overwrite_all, existing RG tags are overwritten. The default is overwrite_all.
.TP 8
.BI "-o " STRING
Write the final output to STRING. The default is to write to stdout.

By default, samtools tries to select a format based on the output
filename extension; if output is to standard output or no format can be
deduced,
.B sam
is selected.
.TP 8
.B -u
Output uncompressed SAM, BAM or CRAM.
.TP 8
.B -w
Overwrite an existing @RG line, if a new one with the same ID value is provided.
.TP 8
.BI --no-PG
Do not add a @PG line to the header of the output file.
.TP 8
.BI "-@, --threads " INT
Number of input/output compression threads to use in addition to main thread [0].

.SH AUTHOR
.PP
Written by Martin Pollard from the Sanger Institute.

.SH SEE ALSO
.IR samtools (1),
.IR samtools-split (1)
.PP
Samtools website: <http://www.htslib.org/>
